//
//  DidGiftCollectionViewCell.m
//  GiftItems
//
//  Created by lanou3g on 15/9/19.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "DidGiftCollectionViewCell.h"

@implementation DidGiftCollectionViewCell
//重写初始化方法
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        //获取当前cell的宽和高
        CGFloat widthCell = self.frame.size.width;
        CGFloat heightCell = self.frame.size.height;
        _nameLable = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, widthCell, 40)];
        _nameLable.textAlignment = NSTextAlignmentCenter;
        _nameLable.font = [UIFont boldSystemFontOfSize:15];
        _nameLable.numberOfLines = 0;
        _nameLable.textColor = [UIColor blackColor];
        [self addSubview:_nameLable];
        
        
        _picImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 40, widthCell, heightCell - 20)];
        _picImage.layer.masksToBounds = YES;
        _picImage.layer.cornerRadius = 10;
        _picImage.backgroundColor = [UIColor whiteColor];
        [self addSubview:_picImage];
    }
    return self;
}
-(void)setValueWith:(DidGiftModel *)model{
    _nameLable.text = model.title;
    [_picImage sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"占位图.jpg"]];
}
@end
